<template>
  <div class="padding_10">
    <!-- 挂取单列表 -->
    <Bill-list v-if="bool" @send="changeBool" />
    <!-- 新增挂取单 -->
    <Add-bill
      v-else
      :o-cus-id="middleCusID"
      :o-cus-name="middleName"
      :o-id="middleId"
      @send="changeBool"
    />
  </div>
</template>

<script>
  export default {
    components: {
      BillList: () => import('./components/billlist.vue'),
      AddBill: () => import('./components/addbill.vue'),
    },
    data() {
      return {
        bool: true,
        middleId: 0,
        middleName: '',
        middleCusID: 0,
      }
    },
    methods: {
      changeBool(obj) {
        this.bool = !this.bool
        if (obj) {
          this.middleId = obj.id
          this.middleName = obj.customer_name
          this.middleCusID = obj.customer_id
        } else {
          this.middleId = 0
          this.middleName = ''
          this.middleCusID = 0
        }
      },
    },
  }
</script>

<style scoped></style>
